package com.knowledge.review.designPatterns.creatormode.factorypattern.abstractfactory;

import lombok.Getter;

/**
 * @author XFW
 * @date 2024/5/6 14:23
 * @Description 调用方
 **/
@Getter
public class Client {

    private AbstractPhone phone;
    private AbstractNoteBook noteBook;

    public Client(ElectronicsAbstractFactory factory) {
        this.phone = factory.createPhone();
        this.noteBook = factory.createNoteBook();
    }

    public void setPhone(AbstractPhone phone) {
        this.phone = phone;
    }

    public void setNoteBook(AbstractNoteBook noteBook) {
        this.noteBook = noteBook;
    }

    public static void main(String[] args) {
        Client client = new Client(new AppleElectronicsFactory());
        final AbstractPhone phone = client.getPhone();
        final AbstractNoteBook noteBook = client.getNoteBook();
        System.out.println(phone);
        System.out.println(noteBook);
    }
}